﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Text;
using System.Threading.Tasks;

namespace Get_NAV
{
    public sealed class Appmanagement
    {
        public PSCommand Commands { get; set; }

        #region Appmanagement

        public void GetNAVAppInfo(string serverInstance)
        {
            Command getCommand = new Command("Get-NAVAppInfo");
            getCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(getCommand);
        }
        public void GetNAVAppInfo(string serverInstance, string tenant)
        {
            Command getCommand = new Command("Get-NAVAppInfo");
            getCommand.Parameters.Add("ServerInstance", serverInstance);
            getCommand.Parameters.Add("Tenant", tenant);

            Commands.AddCommand(getCommand);
        }
        public void GetNAVAppInfoPath(string path)
        {
            Command getCommand = new Command("Get-NAVAppInfo");
            getCommand.Parameters.Add("Path", path);

            Commands.AddCommand(getCommand);
        }

        public void GetNAVAppTenant(string serverInstance)
        {
            Command getCommand = new Command("Get-NAVAppTenant");
            getCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(getCommand);
        }
        public void GetNAVAppTenant(string serverInstance, string path)
        {
            Command getCommand = new Command("Get-NAVAppTenant");
            getCommand.Parameters.Add("ServerInstance", serverInstance);
            getCommand.Parameters.Add("Path", path);

            Commands.AddCommand(getCommand);
        }

        public void InstallNAVApp(string name, string serverInstance)
        {
            Command installCommand = new Command("Install-NAVApp");
            installCommand.Parameters.Add("Name", name);
            installCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(installCommand);
        }

        public void PublishNAVApp(string path, string serverInstance)
        {
            Command publishCommand = new Command("Publish-NAVApp");
            publishCommand.Parameters.Add("Path", path);
            publishCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(publishCommand);
        }

        public void RepairNAVApp(string name, string serverInstance)
        {
            Command repairCommand = new Command("Repair-NAVApp");
            repairCommand.Parameters.Add("Name", name);
            repairCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(repairCommand);
        }

        public void UninstallNAVApp(string name, string serverInstance)
        {
            Command uninstallCommand = new Command("Uninstall-NAVApp");
            uninstallCommand.Parameters.Add("Name", name);
            uninstallCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(uninstallCommand);
        }

        public void UnpublishNAVApp(string name, string serverInstance)
        {
            Command unpublishCommand = new Command("Unpublish-NAVApp");
            unpublishCommand.Parameters.Add("Name", name);
            unpublishCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(unpublishCommand);
        }

        #endregion Appmanagement
    }
}
